<script>
	export default {
		onLaunch: function() {

			// #ifdef APP-PLUS
			let that = this;
			plus.runtime.getProperty(plus.runtime.appid, function(widgetInfo) {
				//APP更新
				//console.log('请求更新前提交的版本='+widgetInfo.version)
				that.$http.request({
					url: that.$api.app_update,
					data: {
						version_number: widgetInfo.version
					}
				}).then(res => {
					//console.log('更新接口返回=='+JSON.stringify(res));
					if (res.code == 0) {
						if (res.data.status == 1) { //1代表有新版本
							if (res.data.type == 0) { //0：全部更新

								uni.showModal({
									title: '提示',
									showCancel: res.data.compulsive == 0 ? true :
									false, //是否强制更新：0：否 1：是
									content: res.data.remark,
									success: function(res2) {
										if (res2.confirm) {
											plus.runtime.openURL(res.data.address);
										} else if (res2.cancel) {

										}
									}
								})
							} else if (res.data.type == 1) { //1：部分更新
								uni.showModal({
									title: '提示',
									content: res.data.remark,
									showCancel: res.data.compulsive == 0 ? true :
									false, //是否强制更新：0：否 1：是
									success: function(res2) {
										if (res2.confirm) {
											uni.navigateTo({
												url: '/pages/about/about?pageSource=2'
											})
										}
									}
								})
							}
						}

					} else {

					}
				})
			});
			// #endif
		},

		onShow: function(options) {
			
		},
		onHide: function() {
			
		},
		methods: {
			
			initMall() {
				this.$http.request({
					url: this.$api.index.config
				}).then(res => {
					if (res.code === 0) {
						let {
							cat_style,
							copyright,
							mall_setting,
							navbar,
							page_title
						} = res.data;
						uni.setStorageSync('tabbars', JSON.stringify(navbar));
						uni.setStorageSync('mall_config', JSON.stringify(res.data));
						this.$nextTick();
					}
				});

			}
		}
	};
</script>

<style>

	/*每个页面公共css */
	@import './common/app.css';
	/* @import './static/font-icon/iconfont.css'; */
	@import './plugins/font-icon/iconfont.css';
	/* #ifdef H5 */
	/* //修复H5底部导航挡住内容bug */
	/* uni-app {
	height: auto;
} */

	/* //修复H5输入框上下不居中bug */
	/* .uni-input-form {
	height: 100%;
} */
	/* //去除地图上高德地图标识符 */
	.amap-copyright {
		display: none !important;
	}

	.amap-logo {
		display: none !important;
	}

	.amap-ui-control-zoom {
		width: 60rpx !important;
	}

	.amap-ui-control-zoom>* {
		width: 60rpx !important;
		height: 60rpx !important;
		line-height: 60rpx !important;
	}

	.amap-ui-control-theme-dark {
		display: none !important;
	}

	/* #endif */
</style>
